package com.doraz.orb.structs;

import java.util.ArrayList;
import java.util.Date;
import java.util.Hashtable;

import com.doraz.orb.utils.IntValidator;

public class OrbItem implements OrbObject {

	private final static String TAG = "OrbItem";
	
	private String mediumId;
	private String title;
	private String path;
	private Date date;
	
	private boolean canStream = false;
	private boolean isVideo = false;
	private boolean isAudio = false;
	
	private Hashtable<String, String> fields;
	
	public OrbItem(String mediumId) {
		this.mediumId = mediumId;
		this.title = "";
		this.fields = new Hashtable<String, String>();
	}
	
	/**
	 * @return the mediumId
	 */
	public String getMediumId() {
		return mediumId;
	}



	/**
	 * @param mediumId the mediumId to set
	 */
	public void setMediumId(String mediumId) {
		this.mediumId = mediumId;
	}
	
	/**
	 * @return the title
	 */
	public String getTitle() {
		return title;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * @return the isVideo
	 */
	public boolean isVideo() {
		return isVideo;
	}



	/**
	 * @param isVideo the isVideo to set
	 */
	public void setVideo(boolean isVideo) {
		this.isVideo = isVideo;
	}



	/**
	 * @return the isAudio
	 */
	public boolean isAudio() {
		return isAudio;
	}



	/**
	 * @param isAudio the isAudio to set
	 */
	public void setAudio(boolean isAudio) {
		this.isAudio = isAudio;
	}



	/**
	 * Stores a field
	 * 
	 * @param name
	 * @param value
	 */
	public void addField(String name, String value) {
		fields.put(name, value);
	}
	
	/**
	 * Gets a field
	 * 
	 * @param name			the name of the field
	 * @param defaultVal	the default value to return (if not found)
	 * @return				the field value
	 */
	public String getField(String name, String defaultVal) {
		if(fields.containsKey(name)) {
			return fields.get(name);
		}
		else {
			return defaultVal;
		}
	}

	@Override
	public int getObjectType() {
		return OrbObject.ORB_ITEM;
	}
	
	
}
